
package com.duobao.gongneng;
import java.awt.*;

import javax.swing.*;

import com.duobao.game.DuobaoSwingLaunch;
import com.duobao.server.*;
import com.duobao.uitl.*;
import com.duobao.view.MainPanel;

import java.awt.event.*;

public class Nannv extends JPanel implements MouseListener,Runnable{
    DuobaoSwingLaunch game;
    Map heroMap;


    JLabel nan;
    JLabel nv;

    JLabel jixu;

    JTextField jtf;
    JLabel tishi;
    public Nannv(DuobaoSwingLaunch game)
    {
        this.game=game;
        this.heroMap=Maps.getMap(this.game.hero.getLocation());
        GridLayout gl=new GridLayout(16,1,1,1);
        this.setLayout(gl);

        setTishi2();
        setFanhuiyouxi();

    }
    private void setTishi2() {
        tishi=new JLabel("请选择你的性别");
        tishi.setFont(myFont.f2);
        tishi.addMouseListener(this);
        JPanel jp1=new JPanel();
        jp1.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
        jp1.add(tishi);
        this.add(jp1);
    }
    private void setFanhuiyouxi() {
        nv=new JLabel();
        nv.addMouseListener(this);
        nv.setFont(myFont.f2);
        nv.setForeground(Color.BLUE);
        nv.setText("<html><u>"+"女"+"</u></html>");


        nan=new JLabel();
        nan.addMouseListener(this);
        nan.setFont(myFont.f2);
        nan.setForeground(Color.BLUE);
        nan.setText("<html><u>"+"男"+"</u>"+"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp"+"</html>");


        JPanel jp4=new JPanel();
        jp4.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
        jp4.add(nan);
        jp4.add(nv);
        this.add(jp4);
    }
    private boolean iFText(JLabel jl)
    {
        boolean f=false;
        if(jl==tishi)
        {
            f=true;
        }
        return f;
    }

    public void mouseClicked(MouseEvent e) {
        // TODO Auto-generated method stub
        if(e.getSource()==this.nan)
        {
            this.game.hero.setSex(true);
        }else
        {
            this.game.hero.setSex(false);
        }
        this.game.setPanel(new MainPanel(this.game,1));
    }
    public void mouseEntered(MouseEvent e) {
        // TODO Auto-generated method stub
        if(iFText((JLabel)e.getSource()))
        {
            ((JLabel)e.getSource()).setCursor(new Cursor(Cursor.TEXT_CURSOR));
        }
    }
    public void mouseExited(MouseEvent e) {
        // TODO Auto-generated method stub

    }
    public void mousePressed(MouseEvent e) {
        // TODO Auto-generated method stub

    }
    public void mouseReleased(MouseEvent e) {
        // TODO Auto-generated method stub

    }
    public void run() {
        // TODO Auto-generated method stub

    }

}
